<!DOCTYPE html>
<html>
  <head lang="en">
    <meta charset="UTF-8" />
    <title>
      Async loading, multiple instances - Lazyload demos
    </title>
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <style type="text/css">
      ul,
      li {
        list-style-type: none;
        margin: 0;
        padding: 0;
      }

      a,
      img {
        display: block;
      }

      img {
        border: 0;
        width: 220px;
        height: 280px;
      }

      img:not([src]) {
        visibility: hidden;
      }

      .flex {
        display: flex;
      }

      .results {
        height: 564px;
        overflow: scroll;
        border: 1px dotted #f00;
        flex-grow: 1;
      }
    </style>
  </head>

  <body>
    <h1>Async loading, multiple instances demo</h1>
    <div class="flex">
      <div id="results1" class="results">
        <ul>
          <li>
            <a href="#/it/donna/stivaletti_cod44721746jj.html"
              ><img
                alt="Stivaletti"
                src="./images/440x560-01.webp"
                width="220"
                height="280"
            /></a>
          </li>
          <li>
            <a href="#/it/donna/open-toe_cod44740806jx.html"
              ><img
                alt="Open toe"
                src="./images/440x560-02.webp"
                width="220"
                height="280"
            /></a>
          </li>
          <li>
            <a href="#/it/donna/sneakers-tennis-shoes-basse_cod44735977gr.html"
              ><img
                alt="Sneakers &amp; Tennis"
                class="lazy"
                data-src="./images/440x560-03.webp"
                width="220"
                height="280"
            /></a>
          </li>
          <li>
            <a href="#/it/donna/sneakers-tennis-shoes-basse_cod44738717am.html"
              ><img
                alt="Sneakers &amp; Tennis shoes basse"
                class="lazy"
                data-src="./images/440x560-04.webp"
                width="220"
                height="280"
            /></a>
          </li>
          <li>
            <a href="#/it/donna/sneakers-tennis-shoes-alte_cod44739940cb.html"
              ><img
                alt="Sneakers &amp; Tennis shoes alte"
                class="lazy"
                data-src="./images/440x560-05.webp"
                width="220"
                height="280"
            /></a>
          </li>
          <li>
            <a href="#/it/donna/sneakers-tennis-shoes-alte_cod44740860xg.html"
              ><img
                alt="Sneakers &amp; Tennis shoes alte"
                class="lazy"
                data-src="./images/440x560-06.webp"
                width="220"
                height="280"
            /></a>
          </li>
          <li>
            <a href="#/it/donna/sneakers-tennis-shoes-basse_cod44738719vn.html"
              ><img
                alt="Sneakers &amp; Tennis shoes basse"
                class="lazy"
                data-src="./images/440x560-07.webp"
                width="220"
                height="280"
            /></a>
          </li>
          <li>
            <a href="#/it/donna/sneakers-tennis-shoes-basse_cod44739938wk.html"
              ><img
                alt="Sneakers &amp; Tennis shoes basse"
                class="lazy"
                data-src="./images/440x560-08.webp"
                width="220"
                height="280"
            /></a>
          </li>
          <li>
            <a href="#/it/donna/stivali_cod44736534fq.html"
              ><img
                alt="Stivali"
                class="lazy"
                data-src="./images/440x560-09.webp"
                width="220"
                height="280"
            /></a>
          </li>
          <li>
            <a href="#/it/donna/stivali_cod44735388ui.html"
              ><img
                alt="Stivali"
                class="lazy"
                data-src="./images/440x560-10.webp"
                width="220"
                height="280"
            /></a>
          </li>
          <li>
            <a href="#/it/donna/stivaletti_cod44739165ev.html"
              ><img
                alt="Stivaletti"
                class="lazy"
                data-src="./images/440x560-11.webp"
                width="220"
                height="280"
            /></a>
          </li>
          <li>
            <a href="#/it/donna/stivaletti_cod44739454hf.html"
              ><img
                alt="Stivaletti"
                class="lazy"
                data-src="./images/440x560-12.webp"
                width="220"
                height="280"
            /></a>
          </li>
          <li>
            <a href="#/it/donna/stivali_cod44719480km.html"
              ><img
                alt="Stivali"
                class="lazy"
                data-src="./images/440x560-13.webp"
                width="220"
                height="280"
            /></a>
          </li>
          <li>
            <a href="#/it/donna/stivaletti_cod44719687td.html"
              ><img
                alt="Stivaletti"
                class="lazy"
                data-src="./images/440x560-14.webp"
                width="220"
                height="280"
            /></a>
          </li>
          <li>
            <a href="#/it/donna/decollete_cod44721899ng.html"
              ><img
                alt="Décolleté"
                class="lazy"
                data-src="./images/440x560-15.webp"
                width="220"
                height="280"
            /></a>
          </li>
          <li>
            <a href="#/it/donna/mocassini_cod44721744sl.html"
              ><img
                alt="Mocassini"
                class="lazy"
                data-src="./images/440x560-16.webp"
                width="220"
                height="280"
            /></a>
          </li>
          <li>
            <a href="#/it/donna/stivaletti_cod44716730kr.html"
              ><img
                alt="Stivaletti"
                class="lazy"
                data-src="./images/440x560-17.webp"
                width="220"
                height="280"
            /></a>
          </li>
          <li>
            <a href="#/it/donna/decollete_cod44718734xl.html"
              ><img
                alt="Décolleté"
                class="lazy"
                data-src="./images/440x560-18.webp"
                width="220"
                height="280"
            /></a>
          </li>
          <li>
            <a href="#/it/donna/decollete_cod44721796uk.html"
              ><img
                alt="Décolleté"
                class="lazy"
                data-src="./images/440x560-19.webp"
                width="220"
                height="280"
            /></a>
          </li>
        </ul>
      </div>
      <div id="results2" class="results">
        <ul>
          <li>
            <a href="#/it/donna/francesine_cod44717679mj.html"
              ><img
                alt="Francesine"
                src="./images/440x560-20.webp"
                width="220"
                height="280"
            /></a>
          </li>
          <li>
            <a href="#/it/donna/stivaletti_cod44724594vu.html"
              ><img
                alt="Stivaletti"
                src="./images/440x560-21.webp"
                width="220"
                height="280"
            /></a>
          </li>
          <li>
            <a href="#/it/donna/decollete_cod44726148aq.html"
              ><img
                alt="Décolleté"
                class="lazy"
                data-src="./images/440x560-22.webp"
                width="220"
                height="280"
            /></a>
          </li>
          <li>
            <a href="#/it/donna/mocassini_cod44719629nt.html"
              ><img
                alt="Mocassini"
                class="lazy"
                data-src="./images/440x560-23.webp"
                width="220"
                height="280"
            /></a>
          </li>
          <li>
            <a href="#/it/donna/mocassini_cod44725329kq.html"
              ><img
                alt="Mocassini"
                class="lazy"
                data-src="./images/440x560-24.webp"
                width="220"
                height="280"
            /></a>
          </li>
          <li>
            <a href="#/it/donna/stivali_cod44724026qs.html"
              ><img
                alt="Stivali"
                class="lazy"
                data-src="./images/440x560-25.webp"
                width="220"
                height="280"
            /></a>
          </li>
          <li>
            <a href="#/it/donna/stivaletti_cod44720256gw.html"
              ><img
                alt="Stivaletti"
                class="lazy"
                data-src="./images/440x560-26.webp"
                width="220"
                height="280"
            /></a>
          </li>
          <li>
            <a href="#/it/donna/stivaletti_cod44722062id.html"
              ><img
                alt="Stivaletti"
                class="lazy"
                data-src="./images/440x560-27.webp"
                width="220"
                height="280"
            /></a>
          </li>
          <li>
            <a href="#/it/donna/mocassini_cod44722402rh.html"
              ><img
                alt="Mocassini"
                class="lazy"
                data-src="./images/440x560-28.webp"
                width="220"
                height="280"
            /></a>
          </li>
          <li>
            <a href="#/it/donna/stivaletti_cod44726296vu.html"
              ><img
                alt="Stivaletti"
                class="lazy"
                data-src="./images/440x560-29.webp"
                width="220"
                height="280"
            /></a>
          </li>
          <li>
            <a href="#/it/donna/stivaletti_cod44725755ct.html"
              ><img
                alt="Stivaletti"
                class="lazy"
                data-src="./images/440x560-30.webp"
                width="220"
                height="280"
            /></a>
          </li>
          <li>
            <a href="#/it/donna/stivaletti_cod44725348nv.html"
              ><img
                alt="Stivaletti"
                class="lazy"
                data-src="./images/440x560-31.webp"
                width="220"
                height="280"
            /></a>
          </li>
          <li>
            <a href="#/it/donna/stivaletti_cod44721879xx.html"
              ><img
                alt="Stivaletti"
                class="lazy"
                data-src="./images/440x560-32.webp"
                width="220"
                height="280"
            /></a>
          </li>
          <li>
            <a href="#/it/donna/cuissardes_cod44729472iq.html"
              ><img
                alt="Cuissardes"
                class="lazy"
                data-src="./images/440x560-33.webp"
                width="220"
                height="280"
            /></a>
          </li>
          <li>
            <a href="#/it/donna/decollete_cod44725388jv.html"
              ><img
                alt="Décolleté"
                class="lazy"
                data-src="./images/440x560-34.webp"
                width="220"
                height="280"
            /></a>
          </li>
          <li>
            <a href="#/it/donna/stivaletti_cod44721854ce.html"
              ><img
                alt="Stivaletti"
                class="lazy"
                data-src="./images/440x560-35.webp"
                width="220"
                height="280"
            /></a>
          </li>
          <li>
            <a href="#/it/donna/sneakers-tennis-shoes-basse_cod44727690jp.html"
              ><img
                alt="Sneakers &amp; Tennis shoes basse"
                class="lazy"
                data-src="./images/440x560-36.webp"
                width="220"
                height="280"
            /></a>
          </li>
          <li>
            <a href="#/it/donna/mocassini_cod44727501hh.html"
              ><img
                alt="Mocassini"
                class="lazy"
                data-src="./images/440x560-37.webp"
                width="220"
                height="280"
            /></a>
          </li>
          <li>
            <a href="#/it/donna/sneakers-tennis-shoes-basse_cod44727038aq.html"
              ><img
                alt="Sneakers &amp; Tennis shoes basse"
                class="lazy"
                data-src="./images/440x560-38.webp"
                width="220"
                height="280"
            /></a>
          </li>
          <li>
            <a href="#/it/donna/mocassini_cod44704882bq.html"
              ><img
                alt="Mocassini"
                class="lazy"
                data-src="./images/440x560-39.webp"
                width="220"
                height="280"
            /></a>
          </li>
          <li>
            <a href="#/it/donna/mocassini_cod44734002vc.html"
              ><img
                alt="Mocassini"
                class="lazy"
                data-src="./images/440x560-40.webp"
                width="220"
                height="280"
            /></a>
          </li>
        </ul>
      </div>
    </div>

    <script>
      function logElementEvent(eventName, element) {
        console.log(Date.now(), eventName, element.getAttribute("data-src"));
      }

      var callback_enter = function (element) {
        logElementEvent("🔑 ENTERED", element);
      };
      var callback_exit = function (element) {
        logElementEvent("🚪 EXITED", element);
      };
      var callback_loading = function (element) {
        logElementEvent("⌚ LOADING", element);
      };
      var callback_loaded = function (element) {
        logElementEvent("👍 LOADED", element);
      };
      var callback_error = function (element) {
        logElementEvent("💀 ERROR", element);
        element.src =
          "./images/440x560-Error.webp";
      };
      var callback_finish = function () {
        logElementEvent("✔️ FINISHED", document.documentElement);
      };
      var callback_cancel = function (element) {
        logElementEvent("🔥 CANCEL", element);
      };

      window.lazyLoadInstances = [];
      window.lazyLoadOptions = [
        {
          container: document.getElementById("results1"),
          // Assign the callbacks defined above
          callback_enter: callback_enter,
          callback_exit: callback_exit,
          callback_cancel: callback_cancel,
          callback_loading: callback_loading,
          callback_loaded: callback_loaded,
          callback_error: callback_error,
          callback_finish: callback_finish
        },
        {
          container: document.getElementById("results2"),
          // Assign the callbacks defined above
          callback_enter: callback_enter,
          callback_exit: callback_exit,
          callback_loading: callback_loading,
          callback_loaded: callback_loaded,
          callback_error: callback_error,
          callback_finish: callback_finish
        }
      ];
      window.addEventListener(
        "LazyLoad::Initialized",
        function (e) {
          var instance = e.detail.instance;
          console.log(instance);
          lazyLoadInstances.push(instance);
        },
        false
      );
    </script>
    <script async src="../dist/lazyload.min.js"></script>
  </body>
</html>
